home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: chang.unx.sas.com!walker
- From: walker@chang.unx.sas.com (Doug Walker)
- Subject: Re: SAS link-error
- Sender: news@unx.sas.com (Noter of Newsworthy Events)
- Message-ID: <Dpnu0M.99F@unx.sas.com>
- Date: Wed, 10 Apr 1996 18:57:58 GMT
- X-Nntp-Posting-Host: chang.unx.sas.com
- References: <762.6674T1119T1484@academy.bastad.se>
- Organization: SAS Institute Inc.
-
- In article <762.6674T1119T1484@academy.bastad.se>,
- Sten <sten@academy.bastad.se> wrote:
- >I get an error when i use a static variable in a C++ Class.
- >--
- >Undefined symbols First Referenced
- >_medel_betyg__4Kurs File 'skol_prog.o'
- >Enter a DEFINE value for _medel_betyg__4Kurs (default ___stub):
- >Error 510: _medel_betyg__4Kurs symbol - Near Reference to data item not in
- >near data section
- >--
- >I've tried to use far data and near data. Both gave this message:
- >--
- >Undefined symbols First Referenced
- >_medel_betyg__4Kurs File 'skol_prog.o'
- >Enter a DEFINE value for _medel_betyg__4Kurs (default ___stub):
- >Error 510: _medel_betyg__4Kurs symbol - Near Reference to data item not in near data section
- >--
- >It works fine when i'm not using static. Please tell me what to do!
- >I don't get all news here - so please send me an Email too.
-
- When you declare a static class member, you must include a definition
- for that member somewhere:
-
- // This declaration goes in a header file
- class foo
- {
- static int x;
- ...other declarations here...
- };
-
- // This definition goes in a C++ source file
- int foo::x;
-
- --
- *****
- *|_o_o|\\ Doug Walker walker@unx.sas.com
- *|. o.| ||
- | o |// Any opinions are mine, not those of SAS Institute, Inc.
- ======
-